package com.vo;

import com.bean.User;

import java.io.Serializable;

public class UserVo implements Serializable {
    private String id;
    private String userName;
    private String password;
    private String realName;
    private String phone;
    private String card;
    private String gender;
    private String age;
    private String role;
    private String spare;
    private String state;

    public User parse(){
        User u = new User();
        try {
            u.setId(Integer.valueOf(this.id));
        } catch (NumberFormatException e) {

        }
        try {
            u.setGender(Integer.valueOf(this.gender));
        } catch (NumberFormatException e) {

        }
        try {
            u.setAge(Integer.valueOf(this.age));
        } catch (NumberFormatException e) {

        }
        try {
            u.setRole(Integer.valueOf(this.role));
        } catch (NumberFormatException e) {

        }
        try {
            u.setSpare(Integer.valueOf(this.spare));
        } catch (NumberFormatException e) {

        }
        try {
            u.setState(Integer.valueOf(this.state));
        } catch (NumberFormatException e) {

        }
        u.setUserName(this.userName);
        u.setPassword(this.password);
        u.setRealName(this.realName);
        u.setPhone(this.phone);
        u.setCard(this.card);

        return u;
    }

    @Override
    public String toString() {
        return "UserVo{" +
                "id='" + id + '\'' +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                ", realName='" + realName + '\'' +
                ", phone='" + phone + '\'' +
                ", card='" + card + '\'' +
                ", gender='" + gender + '\'' +
                ", age='" + age + '\'' +
                ", role='" + role + '\'' +
                ", spare='" + spare + '\'' +
                ", state='" + state + '\'' +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getSpare() {
        return spare;
    }

    public void setSpare(String spare) {
        this.spare = spare;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }
}
